package mappedClass;

// Generated 3 juil. 2014 12:40:01 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "test", uniqueConstraints = @UniqueConstraint(columnNames = "login"))
public class User implements java.io.Serializable {

	private Integer id;
	private UserType userType;
	private String firstName;
	private String lastName;
	private String login;
	private String password;
	private String email;
	private Set<UserTeamHistory> userteamhistories = new HashSet<UserTeamHistory>(0);
	private Set<Team> teams = new HashSet<Team>(0);
	private Set<UserTask> usertasks = new HashSet<UserTask>(0);

	public User() {
	}

	public User(UserType userType, String firstName, String lastName,
			String login, String password, String email) {
		this.userType = userType;
		this.firstName = firstName;
		this.lastName = lastName;
		this.login = login;
		this.password = password;
		this.email = email;
	}

	public User(UserType userType, String firstName, String lastName,
			String login, String password, String email, Set<UserTeamHistory> userteamhistories,
			Set<Team> teams, Set<UserTask> usertasks) {
		this.userType = userType;
		this.firstName = firstName;
		this.lastName = lastName;
		this.login = login;
		this.password = password;
		this.email = email;
		this.userteamhistories = userteamhistories;
		this.teams = teams;
		this.usertasks = usertasks;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userTypeId", nullable = false)
	public UserType getUsertype() {
		return this.userType;
	}

	public void setUsertype(UserType userType) {
		this.userType = userType;
	}

	@Column(name = "firstName", nullable = false, length = 65535)
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	@Column(name = "lastName", nullable = false, length = 65535)
	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	@Column(name = "login", unique = true, nullable = false, length = 100)
	public String getLogin() {
		return this.login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	@Column(name = "password", nullable = false, length = 65535)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "email", nullable = false, length = 65535)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@OneToMany(fetch = FetchType.LAZY)
	public Set<UserTeamHistory> getUserteamhistories() {
		return this.userteamhistories;
	}

	public void setUserteamhistories(Set<UserTeamHistory> userteamhistories) {
		this.userteamhistories = userteamhistories;
	}

	@OneToMany(fetch = FetchType.LAZY)
	public Set<Team> getTeams() {
		return this.teams;
	}

	public void setTeams(Set<Team> teams) {
		this.teams = teams;
	}

	@OneToMany(fetch = FetchType.LAZY)
	public Set<UserTask> getUsertasks() {
		return this.usertasks;
	}

	public void setUsertasks(Set<UserTask> usertasks) {
		this.usertasks = usertasks;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", userType=" + userType + ", firstName="
				+ firstName + ", lastName=" + lastName + ", login=" + login
				+ ", password=" + password + ", email=" + email;
	}

}
